package org.intrasearch.spider;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.slf4j.Logger;

@Singleton
public class StatusLoggerImpl implements StatusLogger
{
    private final Logger logger;
    private String status;


    @Inject
    public StatusLoggerImpl(Logger logger)
    {
        this.logger = logger;
        status = "Idle";
    }

    public void logStatus(String status)
    {
        logger.info(status);
        this.status = status;
    }

    public String recentStatus()
    {
        return status;
    }

    public void logError(String status, Throwable throwable)
    {
        logger.error(status, throwable);
    }
}
